<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.lmpop.trade.ti_member.*"%>
<%@page import="com.lmpop.frame.dao.MenuInfo"%>
<%@page import="com.lmpop.frame.pojo.Menuinfo"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>会员中心</title>
    <link   href="/templets/html/css/main.css" rel="stylesheet" />
<link  href="/templets/html/css/bottom.css" rel="stylesheet" />
	<link href="/program/member/index/css/mall_top.css" rel="stylesheet" type="text/css" />
	<link href="/program/member/index/css/mall_bottom.css" rel="stylesheet" type="text/css" />
	<link href="/program/member/index/css/ht.css" rel="stylesheet" type="text/css" />
	<script src="/program/member/index/js/SetTab.js" type="text/javascript"></script>
	<style type="text/css">
		html, body {height:100%;overflow-x: hidden; overflow-y: auto;}
	
		</style> 
 </head>
  
  <body>
		<% 
	Map menuinfos = new Hashtable();
	menuinfos.put("subsys_code","B2B");
	menuinfos.put("menu_class","1");
	String up_menu_id = "";
	if(request.getParameter("menu_id")!=null && !request.getParameter("menu_id").equals("")){
		up_menu_id = request.getParameter("menu_id");
		menuinfos.put("up_menu_id",up_menu_id);
	}
	
  	String role_code = "";

	if(session.getAttribute("session_role_code")!=null && !((String)session.getAttribute("session_role_code")).equals("")){
		role_code = (String)session.getAttribute("session_role_code");
		menuinfos.put("role_code",role_code);
	}
	 String user_type = "";
	if(session.getAttribute("session_user_type")!=null && !((String)session.getAttribute("session_user_type")).equals("")){
		user_type = (String)session.getAttribute("session_user_type");
		//menuinfos.put("user_type",user_type);
	}
	
	String user_id = "",user_name="";
	if( session.getAttribute("session_user_id") != null )
	{
		user_id = session.getAttribute("session_user_id").toString();
	}
	String cust_id="";
	if( session.getAttribute("session_cust_id") != null )
	{
		cust_id = session.getAttribute("session_cust_id").toString();
	}	
	if( session.getAttribute("session_user_name") != null )
	{
		user_name = session.getAttribute("session_user_name").toString();
	}
	Ti_memberInfo memberInfo = new Ti_memberInfo();
	
	String  cust_class =	memberInfo.getCustClassByPk(cust_id);
	if(cust_class != null && !cust_class.equals("")){
		
		menuinfos.put("cust_class",cust_class);
	}
	MenuInfo menuInfo = new MenuInfo();

	if(up_menu_id.equals(""))  {
		String first_menu_id = menuInfo.getOneLevelFirstMenu(menuinfos,user_type);
	}
	
		List menuList = null;
		
		if(user_type.equals("2")|| user_type.equals("0")) {
		menuList = menuInfo.getMenuinfoByCustClass(menuinfos);
		} else if(user_type.equals("1") || user_type.equals("3")) {
		menuList = menuInfo.getMenuinfoByRole(menuinfos);
		}
%>


<div class="f-left">
	
		<%
			if(menuList!=null && menuList.size()>0){
    				Hashtable mMap = new Hashtable();
    				for(int i=0;i<menuList.size();i++){
    					mMap = (Hashtable)menuList.get(i);
    					String menu_id = "",menu_name="";
    					if(mMap.get("menu_id")!=null) menu_id = mMap.get("menu_id").toString();
    					if(mMap.get("menu_name")!=null) menu_name = mMap.get("menu_name").toString();
    					List children = new ArrayList();
						if(!menu_id.equals("")){
						Map temMap =  new Hashtable();
						temMap.put("up_menu_id",menu_id);   //���⼶Ŀ¼��Ϊ�ϼ�Ŀ¼
						temMap.put("cust_class",cust_class);  //
						
						children = menuInfo.getMenuinfoByUpIdClass(temMap);
						}
		%>
    <div class="w230" style="border:1px solid #F6E3FF;">
      <h1><%=menu_name%></h1>
      <ul>
      	<%
      		if( children != null && children.size() > 0 ){
						 Hashtable twoMenuMap = new Hashtable();
						 for(int j=0;j<children.size();j++){
							twoMenuMap = (Hashtable)children.get(j);
							String c_name = "",c_id = "";
						  if(twoMenuMap.get("menu_id")!=null){
						  	c_id = twoMenuMap.get("menu_id").toString();
						  }
						  if(twoMenuMap.get("menu_name")!=null){
						  	c_name = twoMenuMap.get("menu_name").toString();
						  }
						  
						    List children3 = new ArrayList();
							if(!c_id.equals("")){
							Map temMap3 =  new Hashtable();
							temMap3.put("up_menu_id",c_id);   //���⼶Ŀ¼��Ϊ�ϼ�Ŀ¼
							temMap3.put("cust_class",cust_class);  //
						
						   children3 = menuInfo.getMenuinfoByUpIdClass(temMap3);
						   if( children3 != null && children3.size() > 0 ){
							 Hashtable twoMenuMap3 = new Hashtable();
							 for(int k=0;k<children3.size();k++){
								twoMenuMap3 = (Hashtable)children3.get(k);
								String c_name3 = "",c_id3 = "";
								  if(twoMenuMap3.get("menu_id")!=null){
								  	c_id3 = twoMenuMap3.get("menu_id").toString();
								  }
								  if(twoMenuMap3.get("menu_name")!=null){
								  	c_name3 = twoMenuMap3.get("menu_name").toString();
								  }
									String module_path = menuInfo.getModuleFile(c_id3);
			    					module_path = module_path.replace("WebRoot/","") + "?menu_id=" + c_id3;
			    					String initdispaly = "";
								  if( c_id3.equals( up_menu_id ) ) {
								  		initdispaly = "class=hover" ;
								  }
								  %>
        <li <%=initdispaly%>><a href="<%=module_path%>" target="main"><%=c_name3%></a></li>
        <%
							  }
						   }else{
						   		String module_path = menuInfo.getModuleFile(c_id);
		    					module_path = module_path.replace("WebRoot/","") + "?menu_id=" + c_id;
		    					String initdispaly = "";
								  if( c_id.equals( up_menu_id ) ) {
								  		initdispaly = "class=hover" ;
								  }
								     	%>
									<!--让购物车 跳转到页面外-->
									<%if(c_id.equals("DT3B5tw3V17454a")){%>
									<li <%=initdispaly%>><a href="/templets/html/b2c/jsp/confirm_buycart.jsp" target="_blank"><%=c_name%></a></li>
									<%}else{%>
        <li <%=initdispaly%>><a href="<%=module_path%>" target="main"><%=c_name%></a></li>
									<%}%>
        <%
						   }
        		 }
        	}
        %>
      </ul>
    </div>
    <%
    }
    		}
    	}
    %>
  </div>
  </body>
</html>
